package com.meida.student.app.user.handler;

import com.meida.common.base.entity.EntityMap;
import com.meida.common.mybatis.interceptor.PageInterceptor;
import com.meida.common.mybatis.model.PageParams;
import com.meida.common.mybatis.query.CriteriaQuery;
import com.meida.module.bus.client.entity.BusOrderQuestion;
import com.meida.module.user.client.entity.AppUser;
import com.meida.msg.client.entity.MsgType;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 问题列表分页扩展
 */
@Component("OrderQuestionPageListHandler")
public class OrderQuestionPageListHandler implements PageInterceptor<BusOrderQuestion> {

    @Override
    public void prepare(CriteriaQuery<BusOrderQuestion> cq, PageParams pageParams, EntityMap params) {
        Long orderId=params.getLong("orderId");
        cq.clear();
        cq.select(BusOrderQuestion.class, "questionId", "userId", "userType", "content", "createTime");
        cq.addSelect("user.nickName nickName", "user.avatar avatar");
        cq.eq(BusOrderQuestion.class,"orderId",orderId);
        cq.createJoin(AppUser.class);
    }

    @Override
    public void complete(CriteriaQuery<BusOrderQuestion> cq, List<EntityMap> result, EntityMap extra) {

    }

}
